home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / doom / tw212_sv.zip / TWQWSRC / PLAYER.QC < prev    next >
Text File  |  1997-05-07  |  22KB  |  850 lines

  1. void() bubble_bob;
  2. void() player_chain5;
  3. void() player_chain4;
  4. /*
  5. ==============================================================================
  6.  
  7. PLAYER
  8.  
  9. ==============================================================================
  10. */
  11.  
  12. $cd id1/models/player_4
  13. $origin 0 -6 24
  14. $base base        
  15. $skin skin
  16.  
  17. //
  18. // running
  19. //
  20. $frame axrun1 axrun2 axrun3 axrun4 axrun5 axrun6
  21.  
  22. $frame rockrun1 rockrun2 rockrun3 rockrun4 rockrun5 rockrun6
  23.  
  24. //
  25. // standing
  26. //
  27. $frame stand1 stand2 stand3 stand4 stand5
  28.  
  29. $frame axstnd1 axstnd2 axstnd3 axstnd4 axstnd5 axstnd6
  30. $frame axstnd7 axstnd8 axstnd9 axstnd10 axstnd11 axstnd12
  31.  
  32.  
  33. //
  34. // pain
  35. //
  36. $frame axpain1 axpain2 axpain3 axpain4 axpain5 axpain6
  37.  
  38. $frame pain1 pain2 pain3 pain4 pain5 pain6
  39.  
  40.  
  41. //
  42. // death
  43. //
  44.  
  45. $frame axdeth1 axdeth2 axdeth3 axdeth4 axdeth5 axdeth6
  46. $frame axdeth7 axdeth8 axdeth9
  47.  
  48. $frame deatha1 deatha2 deatha3 deatha4 deatha5 deatha6 deatha7 deatha8
  49. $frame deatha9 deatha10 deatha11
  50.  
  51. $frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
  52. $frame deathb9
  53.  
  54. $frame deathc1 deathc2 deathc3 deathc4 deathc5 deathc6 deathc7 deathc8
  55. $frame deathc9 deathc10 deathc11 deathc12 deathc13 deathc14 deathc15
  56.  
  57. $frame deathd1 deathd2 deathd3 deathd4 deathd5 deathd6 deathd7
  58. $frame deathd8 deathd9
  59.  
  60. $frame deathe1 deathe2 deathe3 deathe4 deathe5 deathe6 deathe7
  61. $frame deathe8 deathe9
  62.  
  63. //
  64. // attacks
  65. //
  66. $frame nailatt1 nailatt2
  67.  
  68. $frame light1 light2
  69.  
  70. $frame rockatt1 rockatt2 rockatt3 rockatt4 rockatt5 rockatt6
  71.  
  72. $frame shotatt1 shotatt2 shotatt3 shotatt4 shotatt5 shotatt6
  73.  
  74. $frame axatt1 axatt2 axatt3 axatt4 axatt5 axatt6
  75.  
  76. $frame axattb1 axattb2 axattb3 axattb4 axattb5 axattb6
  77.  
  78. $frame axattc1 axattc2 axattc3 axattc4 axattc5 axattc6
  79.  
  80. $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
  81.  
  82.  
  83. /*
  84. ==============================================================================
  85. PLAYER
  86. ==============================================================================
  87. */
  88.  
  89. void() player_run;
  90.  
  91. void()    player_stand1 =[    $axstnd1,    player_stand1    ]
  92. {
  93.     self.weaponframe=0;
  94.     if (self.velocity_x || self.velocity_y)
  95.     {
  96.         self.walkframe=0;
  97.         player_run();
  98.         return;
  99.     }
  100.  
  101.     if (self.weapon == IT_AXE)
  102.     {
  103.         if (self.walkframe >= 12)
  104.             self.walkframe = 0;
  105.         self.frame = $axstnd1 + self.walkframe;
  106.     }
  107.     else
  108.     {
  109.         if (self.walkframe >= 5)
  110.             self.walkframe = 0;
  111.         self.frame = $stand1 + self.walkframe;
  112.     }
  113.     self.walkframe = self.walkframe + 1;    
  114. };
  115.  
  116. void()    player_run =[    $rockrun1,    player_run    ]
  117. {
  118.     self.weaponframe=0;
  119.     if (!self.velocity_x && !self.velocity_y)
  120.     {
  121.         self.walkframe=0;
  122.         player_stand1();
  123.         return;
  124.     }
  125.  
  126.     if (self.weapon == IT_AXE)
  127.     {
  128.         if (self.walkframe == 6)
  129.             self.walkframe = 0;
  130.         self.frame = $axrun1 + self.walkframe;
  131.     }
  132.     else
  133.     {
  134.         if (self.walkframe == 6)
  135.             self.walkframe = 0;
  136.         self.frame = self.frame + self.walkframe;
  137.     }
  138.     self.walkframe = self.walkframe + 1;
  139. };
  140.  
  141. void()muzzleflash =
  142. {
  143.     WriteByte (MSG_MULTICAST, SVC_MUZZLEFLASH);
  144.     WriteEntity (MSG_MULTICAST, self);
  145.     multicast (self.origin, MULTICAST_PVS);
  146. };
  147.  
  148.  
  149. void()    player_shot1 =    [$shotatt1, player_shot2    ] {self.weaponframe=1;muzzleflash();};
  150. void()    player_shot2 =    [$shotatt2, player_shot3    ] {self.weaponframe=2;};
  151. void()    player_shot3 =    [$shotatt3, player_shot4    ] {self.weaponframe=3;};
  152. void()    player_shot4 =    [$shotatt4, player_shot5    ] {self.weaponframe=4;};
  153. void()    player_shot5 =    [$shotatt5, player_shot6    ] {self.weaponframe=5;};
  154. void()    player_shot6 =    [$shotatt6, player_run    ] {self.weaponframe=6;};
  155.  
  156. void()    player_axe1 =    [$axatt1, player_axe2    ] {self.weaponframe=1;};
  157. void()    player_axe2 =    [$axatt2, player_axe3    ] {self.weaponframe=2;};
  158. void()    player_axe3 =    [$axatt3, player_axe4    ] {self.weaponframe=3;W_FireAxe();};
  159. void()    player_axe4 =    [$axatt4, player_run    ] {self.weaponframe=4;};
  160.  
  161. void()    player_axeb1 =    [$axattb1, player_axeb2    ] {self.weaponframe=5;};
  162. void()    player_axeb2 =    [$axattb2, player_axeb3    ] {self.weaponframe=6;};
  163. void()    player_axeb3 =    [$axattb3, player_axeb4    ] {self.weaponframe=7;W_FireAxe();};
  164. void()    player_axeb4 =    [$axattb4, player_run    ] {self.weaponframe=8;};
  165.  
  166. void()    player_axec1 =    [$axattc1, player_axec2    ] {self.weaponframe=1;};
  167. void()    player_axec2 =    [$axattc2, player_axec3    ] {self.weaponframe=2;};
  168. void()    player_axec3 =    [$axattc3, player_axec4    ] {self.weaponframe=3;W_FireAxe();};
  169. void()    player_axec4 =    [$axattc4, player_run    ] {self.weaponframe=4;};
  170.  
  171. void()    player_axed1 =    [$axattd1, player_axed2    ] {self.weaponframe=5;};
  172. void()    player_axed2 =    [$axattd2, player_axed3    ] {self.weaponframe=6;};
  173. void()    player_axed3 =    [$axattd3, player_axed4    ] {self.weaponframe=7;W_FireAxe();};
  174. void()    player_axed4 =    [$axattd4, player_run    ] {self.weaponframe=8;};
  175.  
  176. //============================================================================
  177. // ThunderWalker:  Change player animation for grapple to match shooting a harpoon
  178. void()  player_chain1=  [$shotatt2, player_chain2 ] {self.weaponframe=2;Throw_Grapple();};
  179. void()  player_chain2=  [$shotatt4, player_chain3 ] {self.weaponframe=3;};
  180. void()  player_chain3=  [$shotatt6, player_chain3 ]
  181. {
  182.  
  183.  
  184.         self.weaponframe=3;
  185.         if (!self.hook_out)
  186.         {
  187.                 player_chain5();
  188.                 return;
  189.         }
  190.         if (vlen(self.velocity) >= 750)
  191.         {
  192.                 player_chain4();
  193.                 return;
  194.         }
  195. };
  196.  
  197. void() player_chain4=  [$deathc4, player_chain4 ]
  198. {
  199.         self.weaponframe=4;
  200.         if (!self.hook_out)
  201.         {
  202.                 player_chain5();
  203.                 return;
  204.         }
  205.         if (vlen(self.velocity) < 750)
  206.         {
  207.                 player_chain3();
  208.                 return;
  209.         }
  210. };
  211.  
  212. void()  player_chain5=  [$deathd2, player_run    ] {self.weaponframe=5;};
  213.  
  214. //============================================================================
  215.  
  216. //============================================================================
  217.  
  218. void() player_nail1   =[$nailatt1, player_nail2  ] 
  219. {
  220.     muzzleflash();
  221.  
  222.     if (!self.button0 || intermission_running)
  223.         {player_run ();return;}
  224.     self.weaponframe = self.weaponframe + 1;
  225.     if (self.weaponframe == 9)
  226.         self.weaponframe = 1;
  227.     SuperDamageSound();
  228.     W_FireSpikes (4);
  229.     self.attack_finished = time + 0.2;
  230. };
  231. void() player_nail2   =[$nailatt2, player_nail1  ]
  232. {
  233.     muzzleflash();
  234.  
  235.     if (!self.button0 || intermission_running)
  236.         {player_run ();return;}
  237.     self.weaponframe = self.weaponframe + 1;
  238.     if (self.weaponframe == 9)
  239.         self.weaponframe = 1;
  240.     SuperDamageSound();
  241.     W_FireSpikes (-4);
  242.     self.attack_finished = time + 0.2;
  243. };
  244.  
  245. //============================================================================
  246.  
  247. void() player_light1   =[$light1, player_light2  ] 
  248. {
  249.     muzzleflash();
  250.  
  251.     if (!self.button0 || intermission_running)
  252.         {player_run ();return;}
  253.     self.weaponframe = self.weaponframe + 1;
  254.     if (self.weaponframe == 5)
  255.         self.weaponframe = 1;
  256.     SuperDamageSound();
  257. //    W_FireLightning();
  258. //    self.attack_finished = time + 0.2;
  259. };
  260. void() player_light2   =[$light2, player_light1  ]
  261. {
  262.     muzzleflash();
  263.  
  264.     if (!self.button0 || intermission_running)
  265.         {player_run ();return;}
  266.     self.weaponframe = self.weaponframe + 1;
  267.     if (self.weaponframe == 5)
  268.         self.weaponframe = 1;
  269.     SuperDamageSound();
  270. //    W_FireLightning();
  271. //    self.attack_finished = time + 0.2;
  272. };
  273.  
  274. //============================================================================
  275.  
  276.  
  277. void() player_rocket1   =[$rockatt1, player_rocket2  ] {self.weaponframe=1;
  278.     muzzleflash();};
  279. void() player_rocket2   =[$rockatt2, player_rocket3  ] {self.weaponframe=2;};
  280. void() player_rocket3   =[$rockatt3, player_rocket4  ] {self.weaponframe=3;};
  281. void() player_rocket4   =[$rockatt4, player_rocket5  ] {self.weaponframe=4;};
  282. void() player_rocket5   =[$rockatt5, player_rocket6  ] {self.weaponframe=5;};
  283. void() player_rocket6   =[$rockatt6, player_run  ] {self.weaponframe=6;};
  284. void(float num_bubbles) DeathBubbles;
  285.  
  286. void() PainSound =
  287. {
  288. local float        rs;
  289.  
  290.     if (self.health < 0)
  291.         return;
  292.  
  293.     if (damage_attacker.classname == "teledeath")
  294.     {
  295.         sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
  296.         return;
  297.     }
  298.  
  299. // water pain sounds
  300.     if (self.watertype == CONTENT_WATER && self.waterlevel == 3)
  301.     {
  302.         DeathBubbles(1);
  303.         if (random() > 0.5)
  304.             sound (self, CHAN_VOICE, "player/drown1.wav", 1, ATTN_NORM);
  305.         else
  306.             sound (self, CHAN_VOICE, "player/drown2.wav", 1, ATTN_NORM);
  307.         return;
  308.     }
  309.  
  310. // slime pain sounds
  311.     if (self.watertype == CONTENT_SLIME)
  312.     {
  313. // FIX ME    put in some steam here
  314.         if (random() > 0.5)
  315.             sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
  316.         else
  317.             sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
  318.         return;
  319.     }
  320.  
  321.     if (self.watertype == CONTENT_LAVA)
  322.     {
  323.         if (random() > 0.5)
  324.             sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
  325.         else
  326.             sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
  327.         return;
  328.     }
  329.  
  330.     if (self.pain_finished > time)
  331.     {
  332.         self.axhitme = 0;
  333.         return;
  334.     }
  335.     self.pain_finished = time + 0.5;
  336.  
  337. // don't make multiple pain sounds right after each other
  338.  
  339. // ax pain sound
  340.     if (self.axhitme == 1)
  341.     {
  342.         self.axhitme = 0;
  343.         sound (self, CHAN_VOICE, "player/axhit1.wav", 1, ATTN_NORM);
  344.         return;
  345.     }
  346.     
  347.  
  348. rs = rint((random() * 6) + 1);
  349.  
  350.     self.noise = "";
  351.     if (rs == 1)
  352.         self.noise = "player/pain1.wav";
  353. //Thunderwalker Begin:  Ow, Quit it!
  354.     else if (rs == 2)
  355.         self.noise = "tw/twow.wav";
  356. //Thunderwalker End
  357.     else if (rs == 3)
  358.         self.noise = "player/pain2.wav";
  359.     else if (rs == 4)
  360.         self.noise = "player/pain3.wav";
  361.     else if (rs == 5)
  362.         self.noise = "player/pain4.wav";
  363.     else if (rs == 6)
  364.         self.noise = "player/pain5.wav";
  365.     else
  366.         self.noise = "player/pain6.wav";
  367.  
  368.     sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
  369.     return;
  370. };
  371.  
  372. void()    player_pain1 =    [    $pain1,    player_pain2    ] {PainSound();self.weaponframe=0;};
  373. void()    player_pain2 =    [    $pain2,    player_pain3    ] {};
  374. void()    player_pain3 =    [    $pain3,    player_pain4    ] {};
  375. void()    player_pain4 =    [    $pain4,    player_pain5    ] {};
  376. void()    player_pain5 =    [    $pain5,    player_pain6    ] {};
  377. void()    player_pain6 =    [    $pain6,    player_run    ] {};
  378.  
  379. void()    player_axpain1 =    [    $axpain1,    player_axpain2    ] {PainSound();self.weaponframe=0;};
  380. void()    player_axpain2 =    [    $axpain2,    player_axpain3    ] {};
  381. void()    player_axpain3 =    [    $axpain3,    player_axpain4    ] {};
  382. void()    player_axpain4 =    [    $axpain4,    player_axpain5    ] {};
  383. void()    player_axpain5 =    [    $axpain5,    player_axpain6    ] {};
  384. void()    player_axpain6 =    [    $axpain6,    player_run    ] {};
  385.  
  386. void() player_pain =
  387. {
  388.     if (self.weaponframe)
  389.         return;
  390.  
  391.     if (self.invisible_finished > time)
  392.         return;        // eyes don't have pain frames
  393.  
  394.     if (self.weapon == IT_AXE)
  395.         player_axpain1 ();
  396.     else
  397.         player_pain1 ();
  398. };
  399.  
  400. void() player_diea1;
  401. void() player_dieb1;
  402. void() player_diec1;
  403. void() player_died1;
  404. void() player_diee1;
  405. void() player_die_ax1;
  406.  
  407. void() DeathBubblesSpawn =
  408. {
  409. local entity    bubble;
  410.     if (self.owner.waterlevel != 3)
  411.         return;
  412.     bubble = spawn();
  413.     setmodel (bubble, "progs/s_bubble.spr");
  414.     setorigin (bubble, self.owner.origin + '0 0 24');
  415.     bubble.movetype = MOVETYPE_NOCLIP;
  416.     bubble.solid = SOLID_NOT;
  417.     bubble.velocity = '0 0 15';
  418.     bubble.nextthink = time + 0.5;
  419.     bubble.think = bubble_bob;
  420.     bubble.classname = "bubble";
  421.     bubble.frame = 0;
  422.     bubble.cnt = 0;
  423.     setsize (bubble, '-8 -8 -8', '8 8 8');
  424.     self.nextthink = time + 0.1;
  425.     self.think = DeathBubblesSpawn;
  426.     self.air_finished = self.air_finished + 1;
  427.     if (self.air_finished >= self.bubble_count)
  428.         remove(self);
  429. };
  430.  
  431. void(float num_bubbles) DeathBubbles =
  432. {
  433. local entity    bubble_spawner;
  434.     
  435.     bubble_spawner = spawn();
  436.     setorigin (bubble_spawner, self.origin);
  437.     bubble_spawner.movetype = MOVETYPE_NONE;
  438.     bubble_spawner.solid = SOLID_NOT;
  439.     bubble_spawner.nextthink = time + 0.1;
  440.     bubble_spawner.think = DeathBubblesSpawn;
  441.     bubble_spawner.air_finished = 0;
  442.     bubble_spawner.owner = self;
  443.     bubble_spawner.bubble_count = num_bubbles;
  444.     return;
  445. };
  446.  
  447. // ThunderWalker:  added some death sounds
  448.  
  449. void() DeathSound =
  450. {
  451. local float        rs;
  452.  
  453.     // water death sounds
  454.     if (self.waterlevel == 3)
  455.     {
  456.         DeathBubbles(20);
  457.         sound (self, CHAN_VOICE, "player/h2odeath.wav", 1, ATTN_NONE);
  458.         return;
  459.     }
  460.     
  461.     rs = rint ((random() * 9) + 1);
  462.     if (rs == 1)
  463.         self.noise = "player/death1.wav";
  464.     if (rs == 2)
  465.         self.noise = "player/death2.wav";
  466.     if (rs == 3)
  467.         self.noise = "player/death3.wav";
  468.     if (rs == 4)
  469.         self.noise = "player/death4.wav";
  470.     if (rs == 5)
  471.         self.noise = "player/death5.wav";
  472.     if (rs == 6)
  473.         self.noise = "tw/twdeth02.wav";
  474.     if (rs == 7)
  475.         self.noise = "tw/twdeth04.wav";
  476.     if (rs == 8)
  477.         self.noise = "tw/twdeth06.wav";
  478.     if (rs == 9)
  479.         self.noise = "tw/twdeth08.wav";
  480.     if (rs == 10)
  481.         self.noise = "tw/twdeth09.wav";
  482.  
  483.  
  484.     sound (self, CHAN_VOICE, self.noise, 1, ATTN_NONE);
  485.     return;
  486. };
  487.  
  488.  
  489. void() PlayerDead =
  490. {
  491.     self.nextthink = -1;
  492. // allow respawn after a certain time
  493.     self.deadflag = DEAD_DEAD;
  494. };
  495.  
  496. vector(float dm) VelocityForDamage =
  497. {
  498.     local vector v;
  499.  
  500.     v_x = 100 * crandom();
  501.     v_y = 100 * crandom();
  502.     v_z = 200 + 100 * random();
  503.  
  504.     if (dm > -50)
  505.     {
  506. //        dprint ("level 1\n");
  507.         v = v * 0.7;
  508.     }
  509.     else if (dm > -200)
  510.     {
  511. //        dprint ("level 3\n");
  512.         v = v * 2;
  513.     }
  514.     else
  515.         v = v * 10;
  516.  
  517.     return v;
  518. };
  519.  
  520. void(string gibname, float dm) ThrowGib =
  521. {
  522.     local    entity new;
  523.  
  524.     new = spawn();
  525.     new.origin = self.origin;
  526.     setmodel (new, gibname);
  527.     setsize (new, '0 0 0', '0 0 0');
  528.     new.velocity = VelocityForDamage (dm);
  529.     new.movetype = MOVETYPE_BOUNCE;
  530.     new.solid = SOLID_NOT;
  531.     new.avelocity_x = random()*600;
  532.     new.avelocity_y = random()*600;
  533.     new.avelocity_z = random()*600;
  534.     new.think = SUB_Remove;
  535.     new.ltime = time;
  536.     new.nextthink = time + 10 + random()*10;
  537.     new.frame = 0;
  538.     new.flags = 0;
  539. };
  540.  
  541. void(string gibname, float dm) ThrowHead =
  542. {
  543.     setmodel (self, gibname);
  544.     self.frame = 0;
  545.     self.nextthink = -1;
  546.     self.movetype = MOVETYPE_BOUNCE;
  547.     self.takedamage = DAMAGE_NO;
  548.     self.solid = SOLID_NOT;
  549.     self.view_ofs = '0 0 8';
  550.     setsize (self, '-16 -16 0', '16 16 56');
  551.     self.velocity = VelocityForDamage (dm);
  552.     self.origin_z = self.origin_z - 24;
  553.     self.flags = self.flags - (self.flags & FL_ONGROUND);
  554.     self.avelocity = crandom() * '0 600 0';
  555. };
  556.  
  557.  
  558. void() GibPlayer =
  559. {
  560. local    float    twrs;
  561.  
  562.     ThrowHead ("progs/h_player.mdl", self.health);
  563.     ThrowGib ("progs/gib1.mdl", self.health);
  564.     ThrowGib ("progs/gib2.mdl", self.health);
  565.     ThrowGib ("progs/gib3.mdl", self.health);
  566. // ThunderWalker SuperGib begin
  567.     ThrowGib ("progs/gib1.mdl", self.health);
  568.     ThrowGib ("progs/gib2.mdl", self.health);
  569.     ThrowGib ("progs/gib3.mdl", self.health);
  570.     ThrowGib ("progs/gib1.mdl", self.health);
  571.     ThrowGib ("progs/gib2.mdl", self.health);
  572.     ThrowGib ("progs/gib3.mdl", self.health);
  573. // ThunderWalker SuperGib end
  574.  
  575.     self.deadflag = DEAD_DEAD;
  576.  
  577.     if (damage_attacker.classname == "teledeath")
  578.     {
  579.         self.staydeadtime = time + 2 + (random() * 3);
  580.         sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
  581.         return;
  582.     }
  583.  
  584.     if (damage_attacker.classname == "teledeath2")
  585.     {
  586.         self.staydeadtime = time + 3 + (random() * 6);
  587.         sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
  588.         return;
  589.     }
  590. //
  591. //    ThunderWalker
  592. //     Set up to play twgib1.wav only 1 time in 13, as it gets annoying fast.
  593. //
  594. twrs = rint ((random()*12)+1);
  595.     
  596.     if (twrs == 1)
  597.         sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NONE);
  598.     else if (twrs == 2)
  599.         sound (self, CHAN_VOICE, "tw/twargh.wav", 1, ATTN_NONE);
  600.     else if (twrs == 3)
  601.         sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NONE);
  602.     else if (twrs == 4)
  603.         sound (self, CHAN_VOICE, "tw/twgib2.wav", 1, ATTN_NONE);
  604.     else if (twrs == 5)
  605.         sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NONE);
  606.     else if (twrs == 6)
  607.         sound (self, CHAN_VOICE, "tw/twargh.wav", 1, ATTN_NONE);
  608.     else if (twrs == 7)
  609.         sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NONE);
  610.     else if (twrs == 8)
  611.         sound (self, CHAN_VOICE, "tw/twgib2.wav", 1, ATTN_NONE);
  612.     else if (twrs == 9)
  613.         sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NONE);
  614.     else if (twrs == 10)
  615.         sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NONE);
  616.     else if (twrs == 11)
  617.         sound (self, CHAN_VOICE, "tw/twargh.wav", 1, ATTN_NONE);
  618.     else if (twrs == 12)
  619.         sound (self, CHAN_VOICE, "tw/twgib2.wav", 1, ATTN_NONE);
  620.     else if (twrs == 13)
  621.         sound (self, CHAN_VOICE, "tw/twgib1.wav", 1, ATTN_NONE);
  622.  
  623. };
  624.  
  625. void() PlayerDie =
  626. {
  627.     local    float    i;
  628.     
  629.         // make dead guy release hook (wedge)
  630.         if (self.hook_out)
  631.         {
  632.                 Reset_Grapple (self.hook);
  633.                 self.attack_finished = time + 0.75;
  634.                 self.hook_out = TRUE;// PutClientInServer will reset this
  635.         }
  636.  
  637.     self.items = self.items - (self.items & IT_INVISIBILITY);
  638.     self.invisible_finished = 0;    // don't die as eyes
  639.     self.invincible_finished = 0;
  640.     self.super_damage_finished = 0;
  641.     self.radsuit_finished = 0;
  642.     self.modelindex = modelindex_player;    // don't use eyes
  643.  
  644.     DropBackpack();
  645.     DropRune();
  646.     TeamCaptureDropFlagOfPlayer(self);
  647.     
  648.     if (self.killed == 2)
  649.         self.killed = 0;
  650.     else
  651.         self.killed = 1;
  652.  
  653.     self.weaponmodel="";
  654.     self.view_ofs = '0 0 -8';
  655.     self.deadflag = DEAD_DYING;
  656.     self.solid = SOLID_NOT;
  657.     self.flags = self.flags - (self.flags & FL_ONGROUND);
  658.     self.movetype = MOVETYPE_TOSS;
  659.     if (self.velocity_z < 10)
  660.         self.velocity_z = self.velocity_z + random()*300;
  661.  
  662.     if (self.health < -40)
  663.     {
  664.         GibPlayer ();
  665.         return;
  666.     }
  667.  
  668.     DeathSound();
  669.     
  670.     self.angles_x = 0;
  671.     self.angles_z = 0;
  672.     
  673.     if (self.weapon == IT_AXE)
  674.     {
  675.         player_die_ax1 ();
  676.         return;
  677.     }
  678.     
  679.     i = cvar("temp1");
  680.     if (!i)
  681.         i = 1 + floor(random()*6);
  682.     
  683.     if (i == 1)
  684.         player_diea1();
  685.     else if (i == 2)
  686.         player_dieb1();
  687.     else if (i == 3)
  688.         player_diec1();
  689.     else if (i == 4)
  690.         player_died1();
  691.     else
  692.         player_diee1();
  693.  
  694. };
  695.  
  696. void() set_suicide_frame =
  697. {    // used by klill command and diconnect command
  698. /*
  699.     if (self.model != "progs/player.mdl")
  700.         return;    // allready gibbed
  701. */
  702.     if (self.health <= 0)
  703.         return;
  704.     self.frame = $deatha11;
  705.     self.solid = SOLID_NOT;
  706.     self.movetype = MOVETYPE_TOSS;
  707.     self.deadflag = DEAD_DEAD;
  708.     self.nextthink = -1;
  709. };
  710.  
  711.  
  712. void()    player_diea1    =    [    $deatha1,    player_diea2    ] {};
  713. void()    player_diea2    =    [    $deatha2,    player_diea3    ] {};
  714. void()    player_diea3    =    [    $deatha3,    player_diea4    ] {};
  715. void()    player_diea4    =    [    $deatha4,    player_diea5    ] {};
  716. void()    player_diea5    =    [    $deatha5,    player_diea6    ] {};
  717. void()    player_diea6    =    [    $deatha6,    player_diea7    ] {};
  718. void()    player_diea7    =    [    $deatha7,    player_diea8    ] {};
  719. void()    player_diea8    =    [    $deatha8,    player_diea9    ] {};
  720. void()    player_diea9    =    [    $deatha9,    player_diea10    ] {};
  721. void()    player_diea10    =    [    $deatha10,    player_diea11    ] {};
  722. void()    player_diea11    =    [    $deatha11,    player_diea11 ] {PlayerDead();};
  723.  
  724. void()    player_dieb1    =    [    $deathb1,    player_dieb2    ] {};
  725. void()    player_dieb2    =    [    $deathb2,    player_dieb3    ] {};
  726. void()    player_dieb3    =    [    $deathb3,    player_dieb4    ] {};
  727. void()    player_dieb4    =    [    $deathb4,    player_dieb5    ] {};
  728. void()    player_dieb5    =    [    $deathb5,    player_dieb6    ] {};
  729. void()    player_dieb6    =    [    $deathb6,    player_dieb7    ] {};
  730. void()    player_dieb7    =    [    $deathb7,    player_dieb8    ] {};
  731. void()    player_dieb8    =    [    $deathb8,    player_dieb9    ] {};
  732. void()    player_dieb9    =    [    $deathb9,    player_dieb9    ] {PlayerDead();};
  733.  
  734. void()    player_diec1    =    [    $deathc1,    player_diec2    ] {};
  735. void()    player_diec2    =    [    $deathc2,    player_diec3    ] {};
  736. void()    player_diec3    =    [    $deathc3,    player_diec4    ] {};
  737. void()    player_diec4    =    [    $deathc4,    player_diec5    ] {};
  738. void()    player_diec5    =    [    $deathc5,    player_diec6    ] {};
  739. void()    player_diec6    =    [    $deathc6,    player_diec7    ] {};
  740. void()    player_diec7    =    [    $deathc7,    player_diec8    ] {};
  741. void()    player_diec8    =    [    $deathc8,    player_diec9    ] {};
  742. void()    player_diec9    =    [    $deathc9,    player_diec10    ] {};
  743. void()    player_diec10    =    [    $deathc10,    player_diec11    ] {};
  744. void()    player_diec11    =    [    $deathc11,    player_diec12    ] {};
  745. void()    player_diec12    =    [    $deathc12,    player_diec13    ] {};
  746. void()    player_diec13    =    [    $deathc13,    player_diec14    ] {};
  747. void()    player_diec14    =    [    $deathc14,    player_diec15    ] {};
  748. void()    player_diec15    =    [    $deathc15,    player_diec15 ] {PlayerDead();};
  749.  
  750. void()    player_died1    =    [    $deathd1,    player_died2    ] {};
  751. void()    player_died2    =    [    $deathd2,    player_died3    ] {};
  752. void()    player_died3    =    [    $deathd3,    player_died4    ] {};
  753. void()    player_died4    =    [    $deathd4,    player_died5    ] {};
  754. void()    player_died5    =    [    $deathd5,    player_died6    ] {};
  755. void()    player_died6    =    [    $deathd6,    player_died7    ] {};
  756. void()    player_died7    =    [    $deathd7,    player_died8    ] {};
  757. void()    player_died8    =    [    $deathd8,    player_died9    ] {};
  758. void()    player_died9    =    [    $deathd9,    player_died9    ] {PlayerDead();};
  759.  
  760. void()    player_diee1    =    [    $deathe1,    player_diee2    ] {};
  761. void()    player_diee2    =    [    $deathe2,    player_diee3    ] {};
  762. void()    player_diee3    =    [    $deathe3,    player_diee4    ] {};
  763. void()    player_diee4    =    [    $deathe4,    player_diee5    ] {};
  764. void()    player_diee5    =    [    $deathe5,    player_diee6    ] {};
  765. void()    player_diee6    =    [    $deathe6,    player_diee7    ] {};
  766. void()    player_diee7    =    [    $deathe7,    player_diee8    ] {};
  767. void()    player_diee8    =    [    $deathe8,    player_diee9    ] {};
  768. void()    player_diee9    =    [    $deathe9,    player_diee9    ] {PlayerDead();};
  769.  
  770. void()    player_die_ax1    =    [    $axdeth1,    player_die_ax2    ] {};
  771. void()    player_die_ax2    =    [    $axdeth2,    player_die_ax3    ] {};
  772. void()    player_die_ax3    =    [    $axdeth3,    player_die_ax4    ] {};
  773. void()    player_die_ax4    =    [    $axdeth4,    player_die_ax5    ] {};
  774. void()    player_die_ax5    =    [    $axdeth5,    player_die_ax6    ] {};
  775. void()    player_die_ax6    =    [    $axdeth6,    player_die_ax7    ] {};
  776. void()    player_die_ax7    =    [    $axdeth7,    player_die_ax8    ] {};
  777. void()    player_die_ax8    =    [    $axdeth8,    player_die_ax9    ] {};
  778. void()    player_die_ax9    =    [    $axdeth9,    player_die_ax9    ] {PlayerDead();};
  779.  
  780.  
  781. // AIRG_MAIN_START
  782.  
  783.  
  784.  
  785.  
  786.  
  787. // Airfist fire animation.
  788.  
  789.  
  790. //  For the external view we use the rock fire animation with the
  791.  
  792.  
  793. //  recoil part lengthened.
  794.  
  795.  
  796.  
  797.  
  798.  
  799. void() player_airgun1   =[$rockatt1, player_airgun2  ] {self.weaponframe=1;};
  800.  
  801.  
  802. void() player_airgun2   =[$rockatt2, player_airgun3  ] {self.weaponframe=2;};
  803.  
  804.  
  805. void() player_airgun3   =[$rockatt3, player_airgun4  ] {self.weaponframe=3;};
  806.  
  807.  
  808. void() player_airgun4   =[$rockatt3, player_airgun5  ] {self.weaponframe=4;};
  809.  
  810.  
  811. void() player_airgun5   =[$rockatt4, player_airgun6  ] {self.weaponframe=5;};
  812.  
  813.  
  814. void() player_airgun6   =[$rockatt4, player_airgun7  ] {self.weaponframe=6;};
  815.  
  816.  
  817. void() player_airgun7   =[$rockatt5, player_airgun8  ] {self.weaponframe=7;};
  818.  
  819.  
  820. void() player_airgun8   =[$rockatt6, player_run  ] {self.weaponframe = 8;};
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829. // AirFist failed fire animation.
  830.  
  831.  
  832. //  For the external view we use the nail gun fire animation.
  833.  
  834.  
  835.  
  836.  
  837.  
  838. void() player_failedairgun1   =[$nailatt1, player_failedairgun2  ] {self.weaponframe=6;};
  839.  
  840.  
  841. void() player_failedairgun2   =[$nailatt2, player_failedairgun3  ] {self.weaponframe=7;};
  842.  
  843.  
  844. void() player_failedairgun3   =[$nailatt2, player_run  ] {self.weaponframe=8;};
  845.  
  846.  
  847.  
  848. // AIRG_MAIN_END
  849.  
  850.